
<head>
	<link rel="stylesheet" href="<?php echo base_url();?>css/ui/jquery-ui-1.10.4.custom.min.css" type="text/css" />
	
	<script src="<?php echo base_url();?>js/jquery.min.js"></script>
	<script src="<?php echo base_url();?>js/jquery-ui-1.10.4.custom.js"></script>
	<script type="text/javascript">
<!--

function enable_text(status)
{
status=!status;	
document.f1.sd.disabled = status;
document.f1.sd2.disabled = status;
document.f1.smp.disabled = status;
document.f1.smp2.disabled = status;
document.f1.sma.disabled = status;
document.f1.sma2.disabled = status;
}
-->


function enable_text2(status)
{
status=!status;	
document.f1.smp.disabled = status;
document.f1.smp2.disabled = status;
}
//-->

function enable_text3(status)
{
status=!status;	
document.f1.sma.disabled = status;
document.f1.sma2.disabled = status;
}

function enable_text4(status)
{
status=!status;	
document.f1.sd.disabled = status;
document.f1.sd2.disabled = status;
}
//-->

$(document).ready(function(){
    $(function() {
function split( val ) {
                return val.split( /,\s*/ );
        }
                function extractLast( term ) {
                 return split( term ).pop();
        }

        $( "#sd" )
            // don't navigate away from the field on tab when selecting an item
              .bind( "keydown", function( event ) {
                if ( event.keyCode === $.ui.keyCode.TAB &&
                        $( this ).data( "autocomplete" ).menu.active ) {
                    event.preventDefault();
                }
            })
            .autocomplete({
                source: function( request, response ) {
                    $.getJSON( "<?php echo base_url('front/autoSuggest/');?>",{  //Url of controller
                        term: extractLast( request.term )
                    },response );
                },
                search: function() {
                    // custom minLength
                    var term = extractLast( this.value );
                    if ( term.length < 1 ) {
                        return false;
                    }
                },
                focus: function() {
                    // prevent value inserted on focus
                    return false;
                },
                select: function( event, ui ) {
                    var terms = split( this.value );
                    // remove the current input
                    terms.pop();
                    // add the selected item
                    terms.push( ui.item.value );
                    // add placeholder to get the comma-and-space at the end
                    terms.push( "" );
                    this.value = terms.join( "," );
                    return false;
                }
            });
			
			$( "#smp" )
            // don't navigate away from the field on tab when selecting an item
              .bind( "keydown", function( event ) {
                if ( event.keyCode === $.ui.keyCode.TAB &&
                        $( this ).data( "autocomplete" ).menu.active ) {
                    event.preventDefault();
                }
            })
            .autocomplete({
                source: function( request, response ) {
                    $.getJSON( "<?php echo base_url('front/autoSuggest/');?>",{  //Url of controller
                        term: extractLast( request.term )
                    },response );
                },
                search: function() {
                    // custom minLength
                    var term = extractLast( this.value );
                    if ( term.length < 1 ) {
                        return false;
                    }
                },
                focus: function() {
                    // prevent value inserted on focus
                    return false;
                },
                select: function( event, ui ) {
                    var terms = split( this.value );
                    // remove the current input
                    terms.pop();
                    // add the selected item
                    terms.push( ui.item.value );
                    // add placeholder to get the comma-and-space at the end
                    terms.push( "" );
                    this.value = terms.join( "," );
                    return false;
                }
            });
			
			$( "#sma" )
            // don't navigate away from the field on tab when selecting an item
              .bind( "keydown", function( event ) {
                if ( event.keyCode === $.ui.keyCode.TAB &&
                        $( this ).data( "autocomplete" ).menu.active ) {
                    event.preventDefault();
                }
            })
            .autocomplete({
                source: function( request, response ) {
                    $.getJSON( "<?php echo base_url('front/autoSuggest/');?>",{  //Url of controller
                        term: extractLast( request.term )
                    },response );
                },
                search: function() {
                    // custom minLength
                    var term = extractLast( this.value );
                    if ( term.length < 1 ) {
                        return false;
                    }
                },
                focus: function() {
                    // prevent value inserted on focus
                    return false;
                },
                select: function( event, ui ) {
                    var terms = split( this.value );
                    // remove the current input
                    terms.pop();
                    // add the selected item
                    terms.push( ui.item.value );
                    // add placeholder to get the comma-and-space at the end
                    terms.push( "" );
                    this.value = terms.join( "," );
                    return false;
                }
            });
			
         
});
});
</script>
</head>
<div class="row">

<body onload=enable_text(false);>
<?php foreach($show as $row): ?>
		<?php echo form_open_multipart('pengajuan/editpermohonan', 'name ="f1" class="form-horizontal" data-parsley-validate');?> 
		<div class="col-sm-6">
			<section class="panel">
				<header class="bg-info panel-heading font-bold">Biodata</header>
				<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-4 control-label">Nama lengkap</label>
							<div class="col-sm-7">
								<input type="text" name = "nama_lengkap" class="form-control" required value="<?php echo $row->NAMA_LENGKAP?>" data-parsley-trigger="focusout">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Tempat lahir</label>
							<div class="col-sm-7">
								<input type="text" name="tempat_lahir" class="form-control" required value="<?php echo $row->TEMPAT_LAHIR?>" data-parsley-trigger="focusout">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Tanggal lahir</label>
							<div class="col-sm-7">
								<input class="datepicker-input form-control" name="tanggal_lahir" required type="text" data-date-format="dd-mm-yyyy" value="<?php echo $row->TGL_LAHIR?>" data-parsley-trigger="focusout">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Jenis kelamin</label>
							<div class="col-sm-7">
								<div class="radio-inline">
									<label>
										<input type="radio" <?php if($row->JENIS_KELAMIN == 1) echo 'checked'?> name="jenis_kelamin" id="optionsRadios1" value="1">
										Laki-laki
									</label>
								</div>
								<div class="radio-inline">
									<label>
										<input type="radio" <?php if($row->JENIS_KELAMIN == 2) echo 'checked'?> name="jenis_kelamin" id="optionsRadios2" value="2">
										Perempuan
									</label>
								</div>
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Alamat</label>
							<div class="col-sm-7">
								<input type="text" name="alamat" class="form-control" required value="<?php echo $row->ALAMAT?>" data-parsley-trigger="focusout">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Nomor telepon</label>
							<div class="col-sm-7">
								<input type="number" name = "nomor_telepon" class="form-control" required value="<?php echo $row->TELP?>" data-parsley-trigger="focusout" data-parsley-error-message="Mohon Diisi Dengan Angka">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Nomor handphone</label>
							<div class="col-sm-7">
								<input type="number" name="hp" class="form-control" required value="<?php echo $row->HP?>" data-parsley-trigger="focusout" data-parsley-error-message="Mohon Diisi Dengan Angka">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Email</label>
							<div class="col-sm-7">
								<input type="email" class="form-control" required value="<?php echo $row->EMAIL?>">
							</div>
						</div>					
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Jenjang pendidikan</label>
							<div class="col-sm-7">
								<label class="checkbox-inline">
										<input type="checkbox" <?php if($row->TK1 != NULL) echo 'checked'?> id="inlineCheckbox1" value="option1" onclick="enable_text4(this.checked)" /> SD/PAKET A
									</label>
									<label class="checkbox-inline">
										<input type="checkbox" <?php if($row->TK2 != NULL) echo 'checked'?> id="inlineCheckbox2" value="option2" onclick="enable_text2(this.checked)" /> SMP/PAKET B
									</label>
									<label class="checkbox-inline">
										<input type="checkbox" <?php if($row->TK3 != NULL) echo 'checked'?> id="inlineCheckbox3" value="option3" onclick="enable_text3(this.checked)"/> SMA/PAKET C
									</label>																		
							</div>
						</div>					
				</div>
			</section>		
		</div>
		<div class="col-sm-6">
			<section class="panel">
				<header class="bg-info panel-heading font-bold">Upload File</header>
				<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-4 control-label">Upload KTP</label>
							<div class="doc-buttons col-sm-7">
								<a target="_blank" href="<?php echo base_url().$row->ALAMAT_KTP;?>" class="btn btn-sm btn-success"><i class="fa fa-file text"></i>
									<span class="text">KTP</span></a>
								<input type="file" name="file_0" title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Nama SD/PAKET A</label>
							<div class="col-sm-7">
								<input type="text" id ="sd" name="sd" value="<?php if ($row->TK1 == '0') echo ''; else echo $row->TK1?>" class="form-control" data-required="true">
							</div>
						</div>					
						<div class="form-group">
							<label class="col-sm-4 control-label">Upload ijazah</label>
							<div class="doc-buttons col-sm-7">
								<a class="btn btn-sm btn-success" target="_blank" href="<?php echo (!empty($row->ALAMAT_TK1))?base_url().$row->ALAMAT_TK1:"javascript:message()";?>"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
								<input type="file" name="file_1" id="sd2" title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Nama SMP/PAKET B</label>
							<div class="col-sm-7">
								<input type="text" id ="smp" name="smp" value="<?php if ($row->TK2 == '0') echo ''; else echo $row->TK2?>" class="form-control" data-required="true">
							</div>
						</div>	
						<div class="form-group">
							<label class="col-sm-4 control-label">Upload ijazah</label>
							<div class="doc-buttons col-sm-7">
								<a class="btn btn-sm btn-success" target="_blank" href="<?php echo (!empty($row->ALAMAT_TK2))?base_url().$row->ALAMAT_TK2:"javascript:message()";?>"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
								<input type="file" name="file_2" id="smp2" title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-4 control-label">Nama SMA/PAKET C</label>
							<div class="col-sm-7">
								<input type="text" id ="sma" name="sma" value="<?php if ($row->TK3 == '0') echo ''; else echo $row->TK3?>" class="form-control" data-required="true">
							</div>
						</div>	
						<div class="form-group">
							<label class="col-sm-4 control-label">Upload ijazah</label>
							<div class="doc-buttons col-sm-7">
								<a class="btn btn-sm btn-success" target="_blank" href="<?php echo (!empty($row->ALAMAT_TK3))?base_url().$row->ALAMAT_TK3:"javascript:message()";?>"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
								<input type="file" name="file_3" id="sma2" title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
						<div class="form-group">			
							<div class="col-sm-11 control-label">
								<div class="doc-buttons">
									<a href="<?php echo site_url('pengajuan');?>" class="btn btn-sm btn-info"><i class="fa fa-arrow-circle-left text"></i><span class="text"> Kembali</span></a>
									<button class="btn btn-sm btn-info"><i class="fa fa-edit text"></i><span class="text"> Simpan</span></button>
								</div>
							</div>				
						</div>					
					</form>
					<?php endforeach; ?>
					
					
				</div>
			</section>		
		</div>
	</form>	
	</body>
</div>
<script>
function message(){
	alert("Belum ada ijazah !");
}
</script>